UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XThd6j86ju6aE7gHIFzLJZfVJ515QJMIDQJOlRWlz5U=' 
WHERE 
  key_id = '3e97801dd74a0db7432b5f7ff1808d12eede0e0e308c628fffa210a80d67729c' 
  AND (
    token = 'XThd6j86ju6aE7gHIFzLJZfVJ515QJMIDQJOlRWlz5U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026