UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a1nAcwwr+24RBDIknjm/VRTac6PMlCbW0rd6Kalnj00='
WHERE
key_id = 'd5fb28051938ccd42a52183c22b58d9d36c0db0191d5be52d028d9901105d577'
AND (
token = 'a1nAcwwr+24RBDIknjm/VRTac6PMlCbW0rd6Kalnj00='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)