UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rJau06PpCgmEzoF9mFhq8aRnfPikdfRUwvVHu+ifRzw=' 
WHERE 
  key_id = 'df6cf221cbebf9d1d66433ac39e19e15954d99b179d445e2c93565870ad48b34' 
  AND (
    token = 'rJau06PpCgmEzoF9mFhq8aRnfPikdfRUwvVHu+ifRzw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023