UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MY1AlJbpGHrc4rzUpxFzzTSZUcz500sXXZee/r9K+/0=' 
WHERE 
  key_id = '78138ad840b37f80566270567e7a5a20cbe35dc871227a410cd6ca6aa007ad20' 
  AND (
    token = 'MY1AlJbpGHrc4rzUpxFzzTSZUcz500sXXZee/r9K+/0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019