UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4WxsAtpp66DTVrYzDfD1jCgmkEwS78urAGb5AyRh+Yg='
WHERE
key_id = 'bbf2f25f4a278626f4049ec64aac28d329ce3d02075cba1e69d2eea1d2ec4ea0'
AND (
token = '4WxsAtpp66DTVrYzDfD1jCgmkEwS78urAGb5AyRh+Yg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)