UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KJnkDRq+tXJShxIocLgB5FncdBpQRUfaI4ZLYOuNJEA=' 
WHERE 
  key_id = 'c7ecab9d7cece6494bfae91368fa0c80456b762210962aaba09ab56474861693' 
  AND (
    token = 'KJnkDRq+tXJShxIocLgB5FncdBpQRUfaI4ZLYOuNJEA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019