UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7wS1FIHaTCQI4jiQBm7fED6POmWOCmSwhttHbLM7fAQ='
WHERE
key_id = 'cb6bf8b0e5aaf5772a8373dd7182ee2a472310af7557154aec11ae654670f2b7'
AND (
token = '7wS1FIHaTCQI4jiQBm7fED6POmWOCmSwhttHbLM7fAQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)