UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2n3G7/xFy1WiXW5DMvcwLUOzXj/lCxnUJuM8Xopo0oI=' 
WHERE 
  key_id = '39bc56395ee8be8b55aeebad16235774ee72952051e490c98acc5fac9c88f655' 
  AND (
    token = '2n3G7/xFy1WiXW5DMvcwLUOzXj/lCxnUJuM8Xopo0oI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021