UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2t2jhvrxuOw6zmdCpu2GIpAfdYUwyVHSu6HBAAJO6To='
WHERE
key_id = 'a8c3246d9347f8eb682581f7d4a54169ef2ae9ea6f1ac56ae72e051c154179e3'
AND (
token = '2t2jhvrxuOw6zmdCpu2GIpAfdYUwyVHSu6HBAAJO6To='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)