UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wWRG5PZ638eVZdudLUCn0rF19Cpn2b9lvPB+dxY/oek='
WHERE
key_id = 'afded889b8c4e270e9c4cffad5757c628660cd9b89dc0c62f73afd4c02644cea'
AND (
token = 'wWRG5PZ638eVZdudLUCn0rF19Cpn2b9lvPB+dxY/oek='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)