UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AIWKjIVzEEAUNC6riF9+Sp2IXl683lCI+knbxG0cE58=' 
WHERE 
  key_id = '4793ddcc53e92504c39baa539ff39bedb9dda26840ffb43d20f76d804f098066' 
  AND (
    token = 'AIWKjIVzEEAUNC6riF9+Sp2IXl683lCI+knbxG0cE58=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044