UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TNqOtUjSwLa/H6qD6nuSMnhReh4TS6LmcNSrFyBaOtw='
WHERE
key_id = 'c65a404e83fcecb782975d772035f211d389bf274b1bee7b55a81f0ab6231812'
AND (
token = 'TNqOtUjSwLa/H6qD6nuSMnhReh4TS6LmcNSrFyBaOtw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)