UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ko7BEfl65wESMeM8rGiE8IjXEFiBNY9JsKfPLc8PbRI='
WHERE
key_id = '2db0765109561e29ed684d041fb0b59497eb1c85a36c5c349eed185df08a690e'
AND (
token = 'ko7BEfl65wESMeM8rGiE8IjXEFiBNY9JsKfPLc8PbRI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)