UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1HyXrc3W58OXS7uBQDqdWk5iqi4qG+SrKYOUFzZYLDs=' 
WHERE 
  key_id = '8b40ce58815ba7e7f871160a9ed0f8a0933619048466bae9837cb7e28877cb47' 
  AND (
    token = '1HyXrc3W58OXS7uBQDqdWk5iqi4qG+SrKYOUFzZYLDs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018