UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oGzqpcVfOnGDREqIJQhAhG1Og7Lq/VxDV8Sctl5Mykw='
WHERE
key_id = '4d71fa1fa8336e0529d999a06ecfc3c415b54358ec0777b729a892f9f95cbd6a'
AND (
token = 'oGzqpcVfOnGDREqIJQhAhG1Og7Lq/VxDV8Sctl5Mykw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)