UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '12kdK4rNGf2i25DAZcTPxapiI9NV2rTA8MPpLqEoJY4='
WHERE
key_id = '9e84dda46ea1f4e8f1f38d7148e58909f437056eee36cbd4a33a2d4abb7fd30a'
AND (
token = '12kdK4rNGf2i25DAZcTPxapiI9NV2rTA8MPpLqEoJY4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)