UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GOIU0NI0wDMy3NQqrqhkF50DZc9fX+/ajUyV4dGTgjM=' 
WHERE 
  key_id = 'eac9285da5441ec46970c1a8e437691b46f404499645456d87920f8bfecacc34' 
  AND (
    token = 'GOIU0NI0wDMy3NQqrqhkF50DZc9fX+/ajUyV4dGTgjM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040