UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1HfJO92WY9VRGgpX7mn+k3iBmvAYImRgz9AJyA6Q9Q8=' 
WHERE 
  key_id = '37f4c068ea2ae90902699f39732f998e190a9356d370643655059a7152886e21' 
  AND (
    token = '1HfJO92WY9VRGgpX7mn+k3iBmvAYImRgz9AJyA6Q9Q8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043