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