UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ui+zm54AJHn3PaGha3ko6FWrCGsSWwrwU3Jshq2SVKI=' 
WHERE 
  key_id = '922965842fff7b9748bf8eed025290026780dd7d1a152341201400b890023b1d' 
  AND (
    token = 'ui+zm54AJHn3PaGha3ko6FWrCGsSWwrwU3Jshq2SVKI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032