UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'J4bfnGJYzd9ArKqzY3lJw+bcsZ8XGy/H78lKEEXurck='
WHERE
key_id = '3960570beb9a82584b62dbca52c6977a78a060ce36606b4314fcd19382822a4d'
AND (
token = 'J4bfnGJYzd9ArKqzY3lJw+bcsZ8XGy/H78lKEEXurck='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)