UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'T8jhhqPQPBmLQT0H67AOfRdWbAERARlev/puSCSf5Uo='
WHERE
key_id = 'd1eb49c0833b6323e5844e49bbacb089138dae882ce54756096b2371db239a6f'
AND (
token = 'T8jhhqPQPBmLQT0H67AOfRdWbAERARlev/puSCSf5Uo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)