UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZJ37LuWkBnQo8z68GpwepPAUL6QTWkhhjM4XLcUFY4w='
WHERE
key_id = '180922f6976728283e81345f1c989a500f8d2eed459a7d32cb50370d0cc6f01d'
AND (
token = 'ZJ37LuWkBnQo8z68GpwepPAUL6QTWkhhjM4XLcUFY4w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)