UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7bZ/XD15m8pyGeaSFxc0gpoCMhBwR+leqOzNOawXucg=' 
WHERE 
  key_id = 'f3d9ffa83825d50c6c2ac8fdf21aaad97fb7bc5e9b25284b2b32e527aa6ec9a6' 
  AND (
    token = '7bZ/XD15m8pyGeaSFxc0gpoCMhBwR+leqOzNOawXucg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025