UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CsENBK/oI979/tn9zgxwRQcN9nacE/709et2jkwTq3U='
WHERE
key_id = 'caf01480c78ed6a9defef9748ed8ca04cda837255b70c0e789cb82f3df2d56d6'
AND (
token = 'CsENBK/oI979/tn9zgxwRQcN9nacE/709et2jkwTq3U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)