UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LwinoSy5yC6RNLegYQEBfRFUvRgM5jvGkRulP7VrHmg='
WHERE
key_id = 'fa41be7e46cbca1c4cc96de85ee908ccaa0e0a0af67607da3914268806567129'
AND (
token = 'LwinoSy5yC6RNLegYQEBfRFUvRgM5jvGkRulP7VrHmg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)