UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yQUoIUAINE7MNC/Pyp9PTVh6GeBS2Yo7QiEe8uvvR48=' 
WHERE 
  key_id = '33ffc64f267a76f1ee635b0ee77e9df6012936f961374739b95703fcc5d3f1d9' 
  AND (
    token = 'yQUoIUAINE7MNC/Pyp9PTVh6GeBS2Yo7QiEe8uvvR48=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027