UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '57MGbbVrYA6Mej0+t0bfTWv3D2QYAlhWxtFgfPmgMpI='
WHERE
key_id = 'af05f9bce953d1fb6b88d313d99135e89977bc8aec6c26d3162301619773bc2f'
AND (
token = '57MGbbVrYA6Mej0+t0bfTWv3D2QYAlhWxtFgfPmgMpI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)