UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'g39Z8tNATxnoiyUy17rOMIPokF2N15lK3Kh/J9NroDs='
WHERE
key_id = 'f0c388f4f0b365c6c8d41ae05361cd5a3a9edd50bde1b6248fb7a98464b9c5e9'
AND (
token = 'g39Z8tNATxnoiyUy17rOMIPokF2N15lK3Kh/J9NroDs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)