UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+PXESXEaQHTJPd49zkJBb6YeBbCexOsN7gk7uggiEkc='
WHERE
key_id = 'ad4008216101b1bc1d82d3814833c57525a4a1f0da5cbdea5b9c39a53b7add79'
AND (
token = '+PXESXEaQHTJPd49zkJBb6YeBbCexOsN7gk7uggiEkc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)