UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7RZH9KdkU0hKsJQA16pUWZgWY9v0GVh45sRn6oDTmrs=' 
WHERE 
  key_id = '839f8b4e048de77db34b3d5658da7a9fe39cd01675cf4b4b587d42bc1c8f9ba2' 
  AND (
    token = '7RZH9KdkU0hKsJQA16pUWZgWY9v0GVh45sRn6oDTmrs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051