UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NYLlNm02lOddQwdqbLZPF/to47P6mPTchUn532yIRbA='
WHERE
key_id = 'e9eeb36ca791b061098d6d0b469bb3072223643f8a148252cdab91499d908702'
AND (
token = 'NYLlNm02lOddQwdqbLZPF/to47P6mPTchUn532yIRbA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)