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