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